package vfs.obj.association.impl;

import java.sql.Connection;
import vfs.persist.association.impl.VFSPathManagerImpl;
import vfs.persist.association.VFSPathManager;
import vfs.obj.entity.VFSNode;
import vfs.except.VFSException;
import vfs.filter.VFSFilter;
import vfs.obj.association.VFSPath;
import vfs.obj.entity.VFSPathAncestor;
import vfs.obj.entity.VFSPathDescendant;
import java.util.Iterator;

/**
 *
 * @author Matthew Eavenson <durandal@uga.edu>
 */
public class VFSPathImpl implements VFSPath{
    
    private VFSPathManager manager;
    
    public VFSPathImpl(Connection conn){
        manager = new VFSPathManagerImpl(conn);
    }
    
//    public VFSPathImpl(VFSEntityFactory eFactory){
//        manager = new VFSPathManagerImpl(eFactory);
//    }
    
    @Override
    public Iterator<VFSPathAncestor> getAncestors(VFSNode descendant, VFSFilter filter) throws VFSException{
        return manager.getAncestors(descendant, filter);
    }
    
    @Override
    public Iterator<VFSPathDescendant> getDescendants(VFSNode ancestor, VFSFilter filter) throws VFSException{
        return manager.getDescendants(ancestor, filter);
    }
    
    @Override
    public VFSNode getAncestor(VFSNode descendant, int length) throws VFSException{
        return manager.getAncestor(descendant, length);
    }
    
    @Override
    public Iterator<VFSNode> getDescendants(VFSNode ancestor, int length) throws VFSException{
        return manager.getDescendants(ancestor, length);
    }
    
    @Override
    public void addPath(VFSNode ancestor, VFSNode descendant, int length) throws VFSException{
        manager.addPath(ancestor, descendant, length);
    }
    
    @Override
    public void removePath(VFSNode ancestor, VFSNode descendant) throws VFSException{
        manager.removePath(ancestor, descendant);
    }
    
    @Override
    public void removeAll(VFSNode node) throws VFSException{
        manager.removeAll(node);
    }
    
    @Override
    public void removeAncestors(VFSNode node, int length) throws VFSException{
        manager.removeAncestors(node, length);
    }
    
    @Override
    public void alterPath(VFSNode ancestor, VFSNode descendant, int length) throws VFSException{
        manager.alterPath(ancestor, descendant, length);
    }
    
}
